package main

import (
	"errors"
	"fmt"
)

func positive(i int) (bool, error) {
	if i == 0 {
		return false, errors.New("undefined")
	}

	return i > -1, nil
}

func check(i int) {
	pos, err := positive(i)
	if err != nil {
		fmt.Println(i, err)
		return
	}
	if pos {
		fmt.Println(i, "是正数")
	} else {
		fmt.Println(i, "是负数")
	}
}

func main() {
	check(1)
	check(0)
	check(-1)
}
